using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter20
{
	/// <summary>
	/// Example08: Heating a Solid
	/// A 1.0 kg bar of copper is heated at atmospheric pressure.
	/// If its temperature increases from 20 C to 50 C,
	/// (A) what is the work done on the copper bar by the 
	/// surrounding atmosphere?
	/// W = - 1.7 \times 10^{-2} J
	/// (B) What quantity of energy is transfered to the copper
	/// bar by heat?
	/// Q = 1.2 \times 10^4 J
	/// (C) What is the increase in internal energy of the copper 
	/// bar?
	/// \Delta E_{int} = 1.2 \times 10^4 J
	/// </summary>
	public class Example08
	{
		public Example08()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Work W = new L.Work();
			W.J = - 1.013E5*5.1E-5*(50.0-20.0)*1.0/8.92E3;
			result+=Convert.ToString(W.J)+"\r\n";   

			L.Heat Q = new L.Heat();
			Q.J = 1.0*387.0*(50.0-20.0);
			result+=Convert.ToString(Q.J)+"\r\n";   

			L.Energy U = new L.Energy();
			U.VariableQ = true;
		
			L.FundamentalLaw.ThermodynamicsFirstLaw(Q,W,U);
			result+=Convert.ToString(U.J)+"\r\n";    
		}
	}
}
